import fetch from "../config/fetch";
/**
 * 登录
 */
export const login = (date) => fetch("/admin/login", date, "post");

/**
 * 获取用户信息
 */
export const getAdminInfo = () => fetch("/admin/info");
/**
 * 退出登录
 */
export const signout = () => fetch("/admin/signout");
/**
 * 用户注册量
 */
export const userCount = (date) => fetch("/statis/user/" + date + "/count");
/**
 * 某一天订单数量
 */

export const orderCount = (date) => fetch("/statis/order/" + date + "/count");
/**
 * 某一天管理员注册量
 */
export const adminDayCount = (date) =>
  fetch("/statis/admin/" + date + "/count");
/**
 * 管理员数量
 */
export const adminCount = () => fetch("/admin/count");
/**
 * 获取用户数量
 */
export const getUserCount = (data) => fetch("/v1/users/count", data);
/**
 * 获取订单数量
 */
export const getOrderCount = (data) => fetch("/bos/orders/count", data);
/**
 * 获取用户列表
 */
export const getUserList = (date) => fetch("/v1/users/list", date);
/**
 * 获取定位城市
 */
export const cityGuess = () => fetch("/v1/cities", { type: "guess" });
/**
 *  获取餐馆列表
 */
export const getResturants = (date) => fetch("/shopping/restaurants", date);
/**
 * 获取餐馆数量
 */
export const getResturantsCount = () => fetch("/shopping/restaurants/count");
/**
 * 食物种类列表
 */
export const foodCategory = (latitude, longitude) =>
  fetch("/shopping/v2/restaurant/category");
/**
 * 更新餐馆信息
 */
export const updateResturant = (data) =>
  fetch("/shopping/updateshop", data, "post");
/**
 * 获取搜索地址
 */
export const searchplace = (cityid, value) =>
  fetch("/v1/pois", {
    type: "search",
    city_id: cityid,
    keyword: value,
  });
/**
 * 删除餐馆
 */
export const deleteResturant = (restaurant_id) =>
  fetch("/shopping/restaurant/" + restaurant_id, {}, "delete");

/**
 * 获取当前商店食品种类
 */
export const getCategory = (restaurant_id) =>  fetch("/shopping/getcategory/" + restaurant_id);
/**
 * 添加食品种类
 */
export const addCategry = data => fetch('/shopping/addcategory',data,'post')
/**
 * 添加食品
 */
export const addFoods = data => fetch('/shopping/addfood',data,'post')
/**
 * 添加商铺
 */
export const addShop = data => fetch('/shopping/addShop',data,'post')